﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using T.S.BaseData.Api.AppClinet.Commend.Cultivationinfo;
using T.S.BaseData.Api.Dto.Cultivationinfo;
using T.S.BaseData.ErrorCode;

namespace T.S.BaseData.Api.Controllers
{
    /// <summary>
    /// 养殖 控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CultivationinfoController : ControllerBase
    {
        private readonly IMediator mediator;

        public CultivationinfoController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 显示对应的养殖信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<GetCultivationinfoDto>> CultivationinfoGet([FromQuery]CultivationinfoGetCommand request )
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 更新保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> HealthUpd(HealthUpdCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 删除保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>

        [HttpPut]
        public Task<ApiResult<int>> HealthDel(HealthDelCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 对应的养殖企业
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<GetEnterpriseinfoDto>>> EnterpriseinfoGet([FromQuery]EnterpriseinfoGetCommand request)
        {
            return mediator.Send(request);
        }

    }
}
